<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>regist</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<link rel="stylesheet" type="text/css" href="style/style.css" />
	
<script language=JavaScript src="js/regcheck.js"></script>
<script type="text/javascript">
function loadXMLDoc(url,cfunc)
{
	if (window.XMLHttpRequest)
	  {// code for IE7+, Firefox, Chrome, Opera, Safari
	  xmlhttp=new XMLHttpRequest();
	  }
	else
	  {// code for IE6, IE5
	  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
	  }
	xmlhttp.onreadystatechange=cfunc;
	xmlhttp.open("GET",url,true);
	xmlhttp.send();
}
function checkUser(){
var ssn = reg.username.value;
if(!checkUsername()){
	return;
}
ssn = encodeURI(encodeURI(ssn));
document.getElementById("usernameE").innerHTML="正在检测...";
loadXMLDoc("CheckUsernameServlet?username="+ssn+"&uid="+<%=new Date().getTime()%>,function() {
			  if (xmlhttp.readyState==4 && xmlhttp.status==200)
			    {
				var n = xmlhttp.responseText;
				if(n=="0"){
					document.getElementById("usernameE").innerHTML="<font color=green>该用户未注册，可以注册</font>";
				}
				if(n=="1"){
					 document.getElementById("usernameE").innerHTML="<font color=blue>该用户已经注册</font>";
				}
			   
			  }
	});
}
</script>
  </head>
  
  <body>
  <center>
    <div id ="wrap">
		
	
			<jsp:include page="head.jsp"></jsp:include>
			
			<div id="center_pad1">
			<form name="reg" action="regist.do" method="post" onSubmit="return checkdata()">
			<center>
			<table width=600 border=0>
			
			<tr><td>
			用户名</td>
			  <td width=60><input type="text" name="username" onBlur="checkUsername()"></td><td width=400><font color=red>*<button onclick="checkUser()">检测用户名</button><span id="usernameE"></span></font></td>
			</tr>
			
			<tr><td>
			 密码 </td>
		        <td width=60><input type="password" name="password" onBlur="checkPassword()"></td><td width=300><font color=red>*<span id="passwordE"></span></font></p></td></tr>
		        
		    <tr><td>
			 重复密码 </td>
		     <td width=60> <input type="password" name="repassword" onBlur="checkRePassword()" ></td><td width=300><font color=red>*<span id="repasswordE"></span></font></p></td></tr>
		     
			 <tr><td>
			姓名</td>
			 <td width=60>  <input type="text" name="name" onBlur="checkRealName()"></td><td width=300><font color=red>*<span id="nameE"></span></font></p></td></tr>
			 
			<tr><td>
			性别		</td>
			<td width=200> 
			  <label>
			  <input type="radio" name="sex" value="0" >
男</label>
			  
			  <label>
			  	<input type="radio" name="sex" value="1">
女</label>
			  <label>
			  <input type="radio" name="sex" value="2" checked="checked">
不详</label></td> </tr>

			<tr><td>
			邮箱</td>
			   <td width=60> <input type="text" name="email" onblur="checkMail()"></td><td width=300><font color=red>*<span id="mailE"></span></font></p></td></tr>
			 
			<tr><td>
			   验证码</td><td width=60><input type="text" name="ccode" onblur="checkCode()"/></td>
			<td width=300> <img id="code" src="Checkcode?"+<%=new Date().getTime()%> />
	<a href="javascript:;" onclick="document.getElementById('code').src='Checkcode?'+(new Date().getTime());">看不清，换一个</a></p></td></tr>
			  <tr><td>
			    <input type="submit" name="submit" value="提交">
			    </label>	
			    <label>
			    <input name="reset" type="reset" id="reset" value="重置">
			    </label>
			    </td></tr>
			    </table>
			    </center>
			  </form>
			</div>
			
			<jsp:include page="foot.jsp"></jsp:include>
  </div>
  </body>
</html>
